import React from 'react'
import {
    Form,
    Button,
    message,
    Switch,
    Card,
    Icon,
    Input,
    Table,
    Divider,
    Select,
    Popconfirm,
    InputNumber,
} from 'antd'
import { observer, inject } from 'mobx-react'
import _ from 'lodash'
import util from '../../../common/util'
import ExhibitorTable from "./exhibitorTable";
import Tip from "../../common/tip"

const FormItem = Form.Item
const Option = Select.Option;

@inject("store")
@observer
class ExhibitorForm extends React.Component {
    constructor() {
        super()
    }

    componentDidMount() {
        this.props.store.actions.getManageData(this.props.id);
    }
    render() {
        let {store,form} = this.props
        let expoId=store.expoId
        let data=store.expoData
        const actions = store.actions
        let halls=[];
        store.halls.map((hall,index)=>{
            halls.push(<Option key={hall.id}>{hall.value}</Option>);
        })
        const formItemLayout = {
            labelCol: {
                sm: { span: 3 },
            },
            wrapperCol: {
                sm: { span: 20 },
            },
        };
        const tailFormItemLayout = {
            wrapperCol: {
                sm: {
                    span: 8,
                    offset: 3,
                },
            },
        };
        return (
            <div>
                <Tip title={'参展商信息管理'}/>
                <Form layout='horizontal'>
                    <FormItem
                        {...formItemLayout}
                        label='展馆'
                    >
                        <Select style={{width:'250px'}} onChange={actions.hallChange} defaultValue={store.halls.length>0&&store.halls[0].id}>
                            {halls}
                        </Select>
                    </FormItem>
                    <FormItem
                        {...formItemLayout}
                        label='参展商'
                    >
                        <ExhibitorTable form={form}/>
                    </FormItem>
                </Form>
            </div>
        )
    }
}
const Manage = Form.create()(ExhibitorForm);

export default Manage

